<template>
  <div>
    <input
      placeholder="输入关键字搜索"
      v-model.trim="neirong"
      @keyup.enter="fn"
    />
    <HmBiaoGe :list="newdata"  :llst="list" @xiangQing="xiangQing" ></HmBiaoGe>
    <MyTanChuang :flag="flag" :list="list" :res="res" @fn="fn"></MyTanChuang>
    
  </div>
</template>

<script>
import HmBiaoGe from './components/HmBiaoGe.vue'
import MyTanChuang from './components/MyTanChuang.vue'


export default {
  components: {
    HmBiaoGe,
    MyTanChuang
  },
  data() {
    return {
      list: [
        {
          id: 1,
          date: new Date('2022-01-01'),
          uname: '张三',
          result: '感冒',
          information: '感冒药',
        },
        {
          id: 2,
          date: new Date(),
          uname: '李四',
          result: '头疼',
          information: '止疼药',
        },
        {
          id: 3,
          date: new Date(),
          uname: '王五',
          result: '腰疼',
          information: '止疼贴',
        },
      ],
      neirong: '',
      flag:false,
      res:'',
     
    }
  },
  methods: {
    xiangQing(id,res){
      this.id=id
      this.res=res
      this.flag=!this.flag
    },
    fn(){
      this.flag=!this.flag
    }
  },
  computed: {
    newdata() {
    return this.list.filter((item) =>{
      return (
      item.uname.includes(this.neirong) ||
      item.result.includes(this.neirong) ||
      item.information.includes(this.neirong))
    } )
      
    },
  },
  props:{

  }
}
</script>

<style scoped></style>
